<!--
 * @Description: 
 * @Version: 1.0
 * @Autor: wangmeng
 * @Date: 2025-03-05 10:48:39
 * @LastEditors: wamgmeng
 * @LastEditTime: 2025-03-05 11:05:37
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
</head>

<body>
    <!-- <video id="video" controls>
        <source src="./video/宣传片视频.m3u8" type="application/x-mpegURL">
    </video> -->


    <!-- 百度搜索：mp4转m3u8 -->
    <!-- 切片网址：https://www.mp4.to/m3u8/?lang=zh -->


    <video id="video" controls></video>

    <script>
        document.addEventListener('DOMContentLoaded', function () {
            var video = document.getElementById('video');
            var hls = new Hls();
            if (Hls.isSupported()) {
                //加载播放列表文件
                hls.loadSource('./video/宣传片视频.m3u8');
                //将 `video` 元素与Hls实例关联起来
                hls.attachMedia(video);
                //当播放列表解析完毕后执行回调函数
                hls.on(Hls.Events.MANIFEST_PARSED, function () {
                    video.play();
                });
            }
        });


    </script>
</body>

</html>